import request from '@/utils/request';

/**
 * 余额查询初始化
 * @param {Number} id 登录id
 */
export function balanceInit(id) {
  return request({
    url: '/merchant_backend/safety',
    method: 'GET',
    params: { id }
  })
}

/**
 * 余额提现金额查询
 * @param {Number} id 登录id
 */
export function balanceInitMoney(id) {
  return request({
    url: '/merchant_backend/balance',
    method: 'GET',
    params: { id }
  })
}

/**
 * 余额查询分页
 * @param {Number} id 商户id
 * @param {Number} page 分页页码
 * @param {*} date 查询参数
 */
export function balabcePage(id, page, date) {
  return request({
    url: '/merchant_backend/safety',
    method: 'GET',
    params: { id, page, status: date.status, start: date.start, end: date.end }
  })
}

/**
 * 余额查询 搜索
 * @param {Number} id 商户id
 * @param {Object} date 查询参数
 */
export function balanceSearch(id, date) {
  return request({
    url: '/merchant_backend/safety',
    method: 'GET',
    params: { id, status:date.status, start: date.start,end: date.end }
  })
}

/**
 *  提现申请
 *  @param {Number} 提现余额
 */
export function balanceMoney(id, money) {
  const data = {
    id,
    money
  }
  return request({
    url: '/merchant_backend/witness_withdraw',
    method: 'POST',
    data
  })
}

/**
 * 单笔查询
 * @param {Number} id 登录id
 * @param {Number} put_id 流水id
 */
export function balanceWitness(id, put_id) {
  const data = {
    id,
    put_id
  }
  return request({
    url: '/merchant_backend/withness_withdraw_query',
    method: 'POST',
    data
  })
}